﻿
namespace Quotation
{
    public sealed class StockType : FlexibleFlagBase<string, StockType>
    {
        private StockType(string value) : base(value) { }

        public static readonly StockType 股票 = new StockType("A0");
        public static readonly StockType 债券 = new StockType("A1");
        public static readonly StockType 场内基金 = new StockType("A2");
        public static readonly StockType 开放基金 = new StockType("A3");
        public static readonly StockType ETF基金 = new StockType("A4");
        public static readonly StockType 权证 = new StockType("A5");
        public static readonly StockType 回购 = new StockType("A6");
        public static readonly StockType 指数 = new StockType("A8");
        public static readonly StockType 创业板 = new StockType("C0");
        public static readonly StockType 标准券 = new StockType("C1");
        public static readonly StockType 不显示 = new StockType("UD");
        public static readonly StockType 普通期货合约 = new StockType("F1");
        public static readonly StockType 连续期货合约 = new StockType("FC");

        /// <summary>
        /// 隐式类型转换
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static implicit operator StockType(string value)
        {
            if (value == null)
                return default(StockType);
            else
            {
                StockType rtn;
                StockType.TryConvert(value, out rtn);
                return rtn;
            }
        }
    }
}
